import { Key } from 'react'
import { request } from "@/utils/http";
// 引入限制的样式
import type {
  getHosSetListParamsType,
  getHosSetListReturnType,
  addHosSetListParamsType,
  getHosSetListItemsType
} from "./model/hospitalSetTypes";

//医院设置中 获取分页列表
export const getHosSetListRequest = ({ page, limit, hosname, hoscode }: getHosSetListParamsType) => {
  return request.get<any, getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
    params: {
      hosname,
      hoscode
    }
  })
}
// 医院添加中 提交数据
export const addHosSetListRequest = (data: addHosSetListParamsType) => {
  return request.post<any, null>('/admin/hosp/hospitalSet/save', data)
}

// 医院设置中 根据某个id获取详细的医院设置
export const GetDataAccordingToID = (id: string) => {
  // 返回值的类型
  return request.get<any, getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}
//医院设置中 根据id修改数据后，再次提交修改
export const updateHosSetFromIdRequest = (data: addHosSetListParamsType, id?: string) => {
  return request.put<any, null>("/admin/hosp/hospitalSet/update", data)
}
// 医院设置中根据id删除当前列表
export const deleteList = (id: string) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
}
// 医院设置中根据id批量删除数据
export const BatchDeleteDataRequest = (idList: Key[]) => {
  return request.delete<any, null>(`/admin/hosp/hospitalSet/batchRemove`, {
    data: idList
  })
}